package com.kaisa.activity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.kaisa.activity.R;
import com.kaisa.activity.bean.VisaListBean;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.List;

/**
 * Created by Administrator on 2015/12/13.
 */
public class VisaListAdapter extends AppBaseAdapter<VisaListBean>{

    public VisaListAdapter(List<VisaListBean> list, Context context) {
        super(list, context);
        inflater = LayoutInflater.from(context);
    }


    @Override
    public View getItemView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = inflater.inflate(R.layout.item_list_visa,parent,false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        //映射数据
        holder.entityName.setText(list.get(position).getEntityName());
        holder.dictName.setText(list.get(position).getDictName());
        holder.visaPrice.setText("¥ "+list.get(position).getVisaPrice());

        return convertView;
    }

    public static class ViewHolder extends BaseViewHolder{
        @ViewInject(R.id.tv_entityName)
        private TextView entityName;
        @ViewInject(R.id.tv_dictName)
        private TextView dictName;
        @ViewInject(R.id.tv_visaPrice)
        private TextView visaPrice;

        public ViewHolder(View convertView) {
            super(convertView);
            x.view().inject(this,convertView);
        }
    }
}
